package com.xiaohei.question.web.controller;

import com.xiaohei.question.feign.QuestionFeign;
import com.xiaohei.question.pojo.Question;
import entity.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: ZhangYongLiang
 * @Date: 2020/11/15 18:57
 **/
@RestController
@RequestMapping("/question")
@CrossOrigin
public class QuestionWebController {
    @Autowired
    private QuestionFeign questionFeign;

    @RequestMapping(value="/",method = RequestMethod.POST)
    public String indexQuery() {
        return "index";
    }

    @RequestMapping("/randQuestion")
    public Result<Question> randomQuestion(){
        Result<Question> question = questionFeign.randomQuestion();
        return question;
    }
}
